/**
 * @description:
 * @file: element.ts
 * @author: Evan
 * @date: 2025.04.19 15:51:58
 * @week: 周一
 * @version: V
 */

import type { MessageOptions, messageType } from 'element-plus'

/**
 * 信息提示框
 * @param message 提示信息
 * @param type 类型
 * @param opts 配置
 */
export const Message = (message = '', type: messageType = 'success', opts: MessageOptions = {}) => {
  ElMessage({
    message,
    type,
    grouping: true,
    showClose: true,
    ...opts
  })
}

/**
 * 日期禁选
 * @param time 日期对象
 * @returns
 */
export const disabledDate = (time: Date) => {
  time.setHours(0)
  time.setMinutes(0)
  time.setSeconds(0)
  time.setMilliseconds(0)
  return time.getTime() > Date.now()
}
